package com.pacy.pacybaseproject.viewmodels;

import android.app.Application;
import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.pacy.pacybaseproject.R;
import com.pacy.pacybaseproject.activitys.ExchangeDetailActivity;
import com.pacy.pacybaseproject.adapters.HomeMenuAdapter;
import com.pacy.pacybaseproject.adapters.RedempPointsAdapter;
import com.pacy.pacybaseproject.beans.MenuBean;
import com.pacy.pacybaseproject.utils.Constants;

import java.util.ArrayList;
import java.util.List;

import me.goldze.mvvmhabit.base.BaseViewModel;

/**
 * @author PACY
 * @date 2024/4/22
 * description:
 */
public class RedempPointsViewModel extends BaseViewModel {
    public RedempPointsAdapter mAdapter;
    public RedempPointsViewModel(Application application) {
        super(application);
    }
    @Override
    protected void init() {
        super.init();
        initAdapter();
    }

    private void initAdapter(){
        mAdapter=new RedempPointsAdapter();
        List<MenuBean> datas=new ArrayList<>();
        datas.add(new MenuBean("滴滴打车现金券", R.drawable.delete_duihuan_1,"10"));
        datas.add(new MenuBean("公交乘坐周卡", R.drawable.delete_duihuan_2,"30"));
        datas.add(new MenuBean("公交乘车红包", R.drawable.delete_duihuan_3,"1"));
        datas.add(new MenuBean("交通文创吉祥物", R.drawable.delete_duihuan_4,"20"));
        datas.add(new MenuBean("公交乘坐月卡", R.drawable.delete_duihuan_5,"100"));
        datas.add(new MenuBean("公交乘车红包", R.drawable.delete_duihuan_6,"5"));
        mAdapter.setNewInstance(datas);

        mAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter<?, ?> adapter, View view, int position) {
                Bundle bundle=new Bundle();
                bundle.putString("title",mAdapter.getItem(position).getTitle());
                bundle.putString("scroNum",mAdapter.getItem(position).getPrice());
                bundle.putString("priceNum",mAdapter.getItem(position).getPrice());
                bundle.putString("slogen",mAdapter.getItem(position).getSlogan());
                startActivity(ExchangeDetailActivity.class,bundle);
            }
        });
    }
}
